/* eslint-disable class-methods-use-this */
import {
  get,
  post,
  put,
} from '@/lin/plugins/axios'

// 我们通过 class 这样的语法糖使模型这个概念更加具象化，其优点：耦合性低、可维护性。
class Member {
  async getMemberList(page, limit, info) {
    const res = await get(`v1/member?page=${page}&limit=${limit}`, info)
    return res
  }

  async getTimeList(page, limit, info) {
    const res = await get(`v1/member/time?page=${page}&limit=${limit}`, info)
    return res
  }

  async getMoneyList(page, limit, info) {
    const res = await get(`v1/member/money?page=${page}&limit=${limit}`, info)
    return res
  }

  async getWithdrawalList(page, limit, info) {
    const res = await get(`v1/withdrawal?page=${page}&limit=${limit}`, info)
    return res
  }

  async updateWithdrawal(info) {
    const res = await put('v1/withdrawal', info)
    return res
  }

  async getMemberInfo(id) {
    const res = await get(`v1/member/info/${id}`)
    return res
  }

  async updateMemberDate(info) {
    const res = await post('v1/member', info)
    return res
  }

  async updateMember(info) {
    const res = await put('v1/member', info)
    return res
  }
}

export default new Member()
